<?xml version="1.0" encoding="windows-1250"?>
<gxsl:stylesheet xmlns:gxsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias" xml:space="default">
  <gxsl:namespace-alias stylesheet-prefix="xsl" result-prefix="gxsl"/>
  <gxsl:output method="xml" encoding="windows-1250" cdata-section-elements="gxsl:comment" indent="yes"/>

  <gxsl:include href="utils.xsl"/>

  <gxsl:param name="cvincludepage"/>
  <gxsl:param name="cvinclude" select="$cvincludepage/.."/>
  <gxsl:param name="lang">cs</gxsl:param>

  <gxsl:template match="/">
    <xsl:stylesheet version="1.0">
      <xsl:output method="html" indent="no" encoding="windows-1250"/>
      <gxsl:apply-templates select="$cvinclude"/>
    </xsl:stylesheet>
  </gxsl:template>

  <gxsl:template match="CVInclude">

    <gxsl:variable name="dict" select="document('dictionary.xml')/Translation"/>

      <xsl:template match="DPList">

        <xsl:if test="@selectfun and not(@selectfun='')">
          <script language="JavaScript" type="text/javascript">
          <xsl:comment>
          <![CDATA[
            function select(key,]]><gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@basegroup='true' and @onlabel='1']">label<gxsl:value-of select="position()"/>,</gxsl:for-each>defaults)<![CDATA[
            {
                window.opener.]]><xsl:value-of select="@selectfun"/>(key, defaults<gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@basegroup='true' and @onlabel='1']">, label<gxsl:value-of select="position()"/></gxsl:for-each>);<![CDATA[
                top.close();
            }

            function multiselect(keys) {
                window.opener.]]><xsl:value-of select="@selectfun"/><![CDATA[multi(keys);
                top.close();
            }
            ]]>
            //</xsl:comment>
          </script>
        </xsl:if>

        <xsl:choose>
          <xsl:when test="@selectfun and @selectfun!='' and @selectfun!='no'">
            <script language="JavaScript" type="text/javascript">
            <xsl:comment>
            <![CDATA[
              function isSelectfun() {
                return true;
              }
              ]]>
              //</xsl:comment>
            </script>
          </xsl:when>
          <xsl:otherwise>
            <script language="JavaScript" type="text/javascript">
            <xsl:comment>
            <![CDATA[
              function isSelectfun() {
                return false;
              }
              ]]>
              //</xsl:comment>
            </script>
          </xsl:otherwise>
        </xsl:choose>

      <p>
      <font size="+1"><b>
        <gxsl:choose>
          <gxsl:when test="CVITitles/CVITitle">
            <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='listtitle']/Title"/>
          </gxsl:when>
          <gxsl:otherwise><gxsl:value-of select="@concept"/> List</gxsl:otherwise>
        </gxsl:choose>

      </b></font><br/>
      <xsl:text disable-output-escaping="yes">
      <gxsl:if test="CVITitles/CVITitle">
        <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='listtitle']/Descr"/>
      </gxsl:if>
      </xsl:text>
      </p>

      <xsl:variable name="propcols"><gxsl:value-of select="count(CVIProperties/CVIProperty[@onlist='show'])"/></xsl:variable>
      <xsl:variable name="othercols">
        <gxsl:variable name="select">
          <gxsl:if test="@update='1' or @detail='1'">1+</gxsl:if>
          <gxsl:if test="@delete='1'">count(/DPOutput[@access!='r'])+</gxsl:if>
          <gxsl:text>count(/DPOutput/DPList[@selectfun and @selectfun!='no'])+</gxsl:text>
          <gxsl:choose>
            <gxsl:when test="@delete='1' and @deletecoll='1'">count(/DPOutput[@access!='r' or DPList[@selectfun and @selectfun!='no' and @allowmulti='1']])</gxsl:when>
            <gxsl:otherwise>count(/DPOutput/DPList[@selectfun and @selectfun!='no' and @allowmulti='1'])</gxsl:otherwise>
          </gxsl:choose>
        </gxsl:variable>
        <xsl:value-of select="{$select}"/>
      <!--
        <xsl:choose>
          <gxsl:choose>
            <gxsl:when test="@delete='1' and @deletecoll='1'">
              <xsl:when test="/DPOutput/DPList/@selectfun and /DPOutput/DPList/@selectfun!='no'">
                <xsl:value-of >
                  <gxsl:attribute name="select"><gxsl:if test="@delete='1'">count(/DPOutput[@access!='r'])+</gxsl:if><gxsl:if test="@update='1' or @detail='1'">1+</gxsl:if>1+1</gxsl:attribute>
                </xsl:value-of>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of >
                  <gxsl:attribute name="select"><gxsl:if test="@delete='1'">count(/DPOutput[@access!='r'])+</gxsl:if><gxsl:if test="@update='1' or @detail='1'">1+</gxsl:if>1</gxsl:attribute>
                </xsl:value-of>
              </xsl:otherwise>
            </gxsl:when>
            <gxsl:otherwise>
              <xsl:when test="/DPOutput/DPList/@selectfun and /DPOutput/DPList/@selectfun!='no' and /DPOutput/DPList/@allowmulti='1'">
                <xsl:value-of >
                  <gxsl:attribute name="select"><gxsl:if test="@delete='1'">count(/DPOutput[@access!='r'])+</gxsl:if><gxsl:if test="@update='1' or @detail='1'">1+</gxsl:if>1+1</gxsl:attribute>
                </xsl:value-of>
              </xsl:when>
              <xsl:when test="/DPOutput/DPList/@selectfun and /DPOutput/DPList/@selectfun!='no'">
                <xsl:value-of >
                  <gxsl:attribute name="select"><gxsl:if test="@delete='1'">count(/DPOutput[@access!='r'])+</gxsl:if><gxsl:if test="@update='1' or @detail='1'">1+</gxsl:if>1</gxsl:attribute>
                </xsl:value-of>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of >
                  <gxsl:attribute name="select"><gxsl:if test="@delete='1'">count(/DPOutput[@access!='r'])+</gxsl:if><gxsl:if test="@update='1' or @detail='1'">1+</gxsl:if>0</gxsl:attribute>
                </xsl:value-of>
              </xsl:otherwise>
            </gxsl:otherwise>
          </gxsl:choose>
        </xsl:choose>
        -->
      </xsl:variable>

      <table>
        <form action="?" method="post" name="action">
        <input type="hidden" name="keys"/>

        <input type="hidden" name="dp" value="deletecollwc{@id_cvinclude}"/>
        <input type="hidden" name="{@conceptcoll}" value=""/>
        <gxsl:for-each select="Schedules/DeleteVirtualSchedule/SchedItem[@reltype='1:1']">
          <input type="hidden" name="{@path}s" value=""/>
        </gxsl:for-each>

        <xsl:apply-templates select="DPFilter">
          <xsl:with-param name="propcols" select="$propcols"/>
          <xsl:with-param name="othercols" select="$othercols"/>
        </xsl:apply-templates>

        <tr>

        <xsl:choose>
          <xsl:when test="@orderkey='no'">
            <th>#&#160;</th>
          </xsl:when>
          <xsl:otherwise>
            <th><a>
              <xsl:attribute name="href">
                <xsl:text>?dp=</xsl:text><xsl:value-of select="/DPOutput/@dataport"/>
                <xsl:text>&amp;<gxsl:value-of select="@concept"/>.orderby=</xsl:text>
                <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                  <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                    <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                  </gxsl:if>
                </gxsl:for-each>
                <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                  <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                  <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                    <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                  </gxsl:if>
                </gxsl:for-each>
              </xsl:attribute>#</a>&#160;</th>
          </xsl:otherwise>
        </xsl:choose>

        <gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']">
          <gxsl:choose>
            <gxsl:when test="not(RefProp)">
              <xsl:choose>
                <xsl:when test="@orderby='{@name}'">
                  <th class="ordered"><a>
                    <xsl:attribute name="href">
                      <xsl:text>?dp=</xsl:text><xsl:value-of select="/DPOutput/@dataport"/><xsl:text>&amp;</xsl:text>
                      <xsl:text><gxsl:value-of select="../../@concept"/>.orderby=<gxsl:value-of select="@name"/>&amp;</xsl:text>
                      <xsl:text><gxsl:value-of select="../../@concept"/>.order=</xsl:text><xsl:choose><xsl:when test="@order='desc'">asc</xsl:when><xsl:otherwise>desc</xsl:otherwise></xsl:choose>
                      <gxsl:for-each select="../../ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                        <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                          <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                      <gxsl:for-each select="../../ancestor::CVInclude/Keys/Binding">
                        <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                        <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                          <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                    </xsl:attribute>
                    <gxsl:call-template name="tooltip"><gxsl:with-param name="title" select="Title"/><gxsl:with-param name="desc" select="Descr"/></gxsl:call-template>
                    <gxsl:value-of select="Title"/></a><xsl:if test="@order='desc'">*</xsl:if></th>
                </xsl:when>
                <xsl:otherwise>
                  <th><a>
                    <xsl:attribute name="href">
                      <xsl:text>?dp=</xsl:text><xsl:value-of select="/DPOutput/@dataport"/><xsl:text>&amp;</xsl:text>
                      <xsl:text><gxsl:value-of select="../../@concept"/>.orderby=<gxsl:value-of select="@name"/></xsl:text>
                      <gxsl:for-each select="../../ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                        <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                          <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                      <gxsl:for-each select="../../ancestor::CVInclude/Keys/Binding">
                        <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                        <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                          <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                    </xsl:attribute>
                    <gxsl:call-template name="tooltip"><gxsl:with-param name="title" select="Title"/><gxsl:with-param name="desc" select="Descr"/></gxsl:call-template>
                    <gxsl:value-of select="Title"/></a></th>
                </xsl:otherwise>
              </xsl:choose>
            </gxsl:when>

            <gxsl:otherwise>
              <gxsl:for-each select="RefProp">
                <gxsl:variable name="rptitle">
                  <gxsl:choose>
                    <gxsl:when test="last()>1"><gxsl:value-of select="../Title"/>: <gxsl:value-of select="Title"/></gxsl:when>
                    <gxsl:otherwise><gxsl:value-of select="../Title"/></gxsl:otherwise>
                  </gxsl:choose>
                </gxsl:variable>
                <gxsl:variable name="rpdescr">
                  <gxsl:choose>
                    <gxsl:when test="last()>1"><gxsl:value-of select="Descr"/></gxsl:when>
                    <gxsl:otherwise><gxsl:value-of select="../Descr"/></gxsl:otherwise>
                  </gxsl:choose>
                </gxsl:variable>

                <xsl:choose>
                  <xsl:when test="@orderby='{../@nickname}.{@refconcept}/{@code}'">
                    <th class="ordered"><a>
                      <xsl:attribute name="href">
                        <xsl:text>?dp=</xsl:text><xsl:value-of select="/DPOutput/@dataport"/><xsl:text>&amp;</xsl:text>
                        <xsl:text><gxsl:value-of select="../../../@concept"/>.orderby=<gxsl:value-of select="../@nickname"/>.<gxsl:value-of select="@refconcept"/>/<gxsl:value-of select="@code"/>&amp;</xsl:text>
                        <xsl:text><gxsl:value-of select="../../../@concept"/>.order=</xsl:text><xsl:choose><xsl:when test="@order='desc'">asc</xsl:when><xsl:otherwise>desc</xsl:otherwise></xsl:choose>
                        <gxsl:for-each select="../../../ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                          <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                            <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                          </gxsl:if>
                        </gxsl:for-each>
                        <gxsl:for-each select="../../../ancestor::CVInclude/Keys/Binding">
                          <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                          <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                            <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                          </gxsl:if>
                        </gxsl:for-each>
                      </xsl:attribute>
                      <gxsl:call-template name="tooltip"><gxsl:with-param name="title" select="$rptitle"/><gxsl:with-param name="desc" select="$rpdescr"/></gxsl:call-template>
                      <gxsl:value-of select="$rptitle"/></a><xsl:if test="@order='desc'">*</xsl:if></th>
                  </xsl:when>
                  <xsl:otherwise>
                    <th><a>
                      <xsl:attribute name="href">
                        <xsl:text>?dp=</xsl:text><xsl:value-of select="/DPOutput/@dataport"/><xsl:text>&amp;</xsl:text>
                        <xsl:text><gxsl:value-of select="../../../@concept"/>.orderby=<gxsl:value-of select="../@nickname"/>.<gxsl:value-of select="@refconcept"/>/<gxsl:value-of select="@code"/></xsl:text>
                        <gxsl:for-each select="../../../ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                          <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                            <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                          </gxsl:if>
                        </gxsl:for-each>
                        <gxsl:for-each select="../../../ancestor::CVInclude/Keys/Binding">
                          <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                          <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                            <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                          </gxsl:if>
                        </gxsl:for-each>
                      </xsl:attribute>
                      <gxsl:call-template name="tooltip"><gxsl:with-param name="title" select="$rptitle"/><gxsl:with-param name="desc" select="$rpdescr"/></gxsl:call-template>
                      <gxsl:value-of select="$rptitle"/></a></th>
                  </xsl:otherwise>
                </xsl:choose>
              </gxsl:for-each>
            </gxsl:otherwise>
          </gxsl:choose>
        </gxsl:for-each>

        <xsl:if test="/DPOutput/DPList/@filterfirst!='1'">
        <gxsl:if test="@update='1' and @detail='1'">
          <th>&#160;</th>
        </gxsl:if>
        <gxsl:if test="@delete='1'">
          <xsl:if test="/DPOutput/@access!='r'">
            <gxsl:if test="@deletecoll='1'">
              <gxsl:for-each select="../CVIRBindings/CVIRBinding">
                <input type="hidden" name="{@p1}" value="{{../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}}}"/>
              </gxsl:for-each>
  
              <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                  <input type="hidden" name="{@p1}" value="{{../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}}}"/>
                </gxsl:if>
              </gxsl:for-each>
  
              <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                  <input type="hidden" name="{@property}" value="{{../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}}}"/>
                </gxsl:if>
              </gxsl:for-each>
            </gxsl:if>
            <gxsl:choose>
              <gxsl:when test="@required='-'">
                <xsl:if test="/DPOutput/DPList/DPPage/@total!=1">
                  <gxsl:choose>
                    <gxsl:when test="@deletecoll='1'">
                      <th><input type="button" name="deleteapply" disabled="true" value="{$dict/Text[@tid='rmv']/Value[@lang=$lang]}" class="input_filter" onclick="deleteApply();"/></th>
                    </gxsl:when>
                    <gxsl:otherwise>
                      <th>&#160;</th>
                    </gxsl:otherwise>
                  </gxsl:choose>
                </xsl:if>
              </gxsl:when>
              <gxsl:otherwise>
                <gxsl:choose>
                  <gxsl:when test="@deletecoll='1'">
                    <th><input type="button" name="deleteapply" disabled="true" value="{$dict/Text[@tid='rmv']/Value[@lang=$lang]}" class="input_filter" onclick="deleteApply();"/></th>
                  </gxsl:when>
                  <gxsl:otherwise>
                    <th>&#160;</th>
                  </gxsl:otherwise>
                </gxsl:choose>
              </gxsl:otherwise>
            </gxsl:choose>
          </xsl:if>
        </gxsl:if>
        <xsl:if test="@selectfun and @selectfun!='' and @selectfun!='no'">
          <xsl:choose>
            <xsl:when test="@allowmulti='1'">
              <th><input type="button" name="selectapply" disabled="true" value="{$dict/Text[@tid='select']/Value[@lang=$lang]}" class="input_filter" onclick="selectApply();"/></th>
            </xsl:when>
            <xsl:otherwise>
              <th>&#160;</th>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:if>
<!--
        <gxsl:choose>
          <gxsl:when test="@delete='1' and @deletecoll='1'">
            <gxsl:choose>
              <gxsl:when test="@required='-'">
                <xsl:if test="/DPOutput/DPList/DPPage/@total!=1 or (@selectfun and @selectfun!='' and @selectfun!='no' and @allowmulti='1')">
                  <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
                </xsl:if>
              </gxsl:when>
              <gxsl:otherwise>
                <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
              </gxsl:otherwise>
            </gxsl:choose>
          </gxsl:when>
          <gxsl:otherwise>
            <xsl:if test="@selectfun and @selectfun!='' and @selectfun!='no' and @allowmulti='1'">
              <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
            </xsl:if>
          </gxsl:otherwise>
        </gxsl:choose>
-->
        <gxsl:choose>
          <gxsl:when test="@delete='1' and @deletecoll='1'">
            <xsl:choose>
              <xsl:when test="/DPOutput/@access!='r'">
                <gxsl:choose>
                  <gxsl:when test="@required='-'">
                    <xsl:if test="/DPOutput/DPList/DPPage/@total!=1 or (@selectfun and @selectfun!='' and @selectfun!='no' and @allowmulti='1')">
                      <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
                    </xsl:if>
                  </gxsl:when>
                  <gxsl:otherwise>
                    <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
                  </gxsl:otherwise>
                </gxsl:choose>
              </xsl:when>
              <xsl:otherwise>
                <xsl:if test="@selectfun and @selectfun!='' and @selectfun!='no' and @allowmulti='1'">
                  <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
                </xsl:if>
              </xsl:otherwise>
            </xsl:choose>
          </gxsl:when>
          <gxsl:otherwise>
            <xsl:if test="@selectfun and @selectfun!='' and @selectfun!='no' and @allowmulti='1'">
              <th><gxsl:value-of select="$dict/Text[@tid='checkall']/Value[@lang=$lang]"/> <input type="checkbox" name="all" onClick="selectAll();"/></th>
            </xsl:if>
          </gxsl:otherwise>
        </gxsl:choose>
        </xsl:if>
        </tr>
        </form>

        <script language="JavaScript" type="text/javascript">
          <xsl:comment>
            <![CDATA[
              function compute() {
                var allselectedflag = true;
                var h = document.forms["action"].keys;
                h.value = "";
                for (i = 0; i < document.forms.length; i++) {
                  var form = document.forms[i];
                  if (form.name=='selection') {
                    if (form.selected.checked) {
                      if (h.value == "") {
                        h.value = form.key.value;
                      } else {
                        h.value = h.value+","+form.key.value;
                      }
                    } else allselectedflag = false;
                  }
                }

                if (document.forms["action"].keys.value != "") {
                  var e = document.forms["action"].elements;
                  for (i = 0; i < e.length; i++) {
                    if (e[i].name=="selectapply" || e[i].name=="deleteapply") e[i].disabled = false;
                  }
                } else {
                  var e = document.forms["action"].elements;
                  for (i = 0; i < e.length; i++) {
                    if (e[i].name=="selectapply" || e[i].name=="deleteapply") e[i].disabled = true;
                  }
                }

                document.forms["action"].all.checked = allselectedflag;
              }

              function selectApply() {
                multiselect(document.forms["action"].keys.value);
              }

              function deleteApply() {
                if (!confirm("]]><gxsl:value-of select="$dict/Text[@tid='cfmdelcoll']/Value[@lang=$lang]"/><![CDATA[")) return;
                var t = "<]]><gxsl:value-of select="@conceptcoll"/><![CDATA[>";
                var forms = document.forms;
                for (i = 0; i < forms.length; i++) {
                  var form = forms[i];
                  var h;
                  if (form.name=='selection' && form.selected.checked) {
                    t = t+ "<]]><gxsl:value-of select="@concept"/><![CDATA[";
            ]]><gxsl:for-each select="CVIProperties/CVIProperty[@key='1' and @attr='1']"><![CDATA[
                    h = form.]]><gxsl:value-of select="@formcode"/><![CDATA[.value;
                    h = h.replace(/&/g,'&amp;');
                    h = h.replace(/</g,'&lt;');
                    t = t + " ]]><gxsl:value-of select="@nicknamelow"/><![CDATA[=\"" + h + "\"";
            ]]></gxsl:for-each><![CDATA[
                    t = t + ">";
            ]]><gxsl:for-each select="CVIProperties/CVIProperty[@key='1' and @attr='0']"><![CDATA[
                    h = form.]]><gxsl:value-of select="@formcode"/><![CDATA[.value;
                    h = h.replace(/&/g,'&amp;');
                    h = h.replace(/</g,'&lt;');
                    t = t + "<]]><gxsl:value-of select="@nickname"/><![CDATA[>" + h + "</]]><gxsl:value-of select="@nickname"/><![CDATA[>";
            ]]></gxsl:for-each><![CDATA[
                    t = t + "</]]><gxsl:value-of select="@concept"/><![CDATA[>";
                  }
                }
                t = t + "</]]><gxsl:value-of select="@conceptcoll"/><![CDATA[>";
                forms.action.]]><gxsl:value-of select="@conceptcoll"/><![CDATA[.value = t;


            ]]><gxsl:for-each select="Schedules/DeleteVirtualSchedule/SchedItem[@reltype='1:1']"><![CDATA[
                var t = "<]]><gxsl:value-of select="@concept"/>s<![CDATA[>";
                var forms = document.forms;
                for (i = 0; i < forms.length; i++) {
                  var form = forms[i];
                  var h;
                  if (form.name=='selection' && form.selected.checked) {
                    t = t+ "<]]><gxsl:value-of select="@concept"/><![CDATA[";
            ]]><gxsl:for-each select="../../../CVIProperties/CVIProperty[PropGroup/@virtual='1' and @key='1' and @attr='1']"><![CDATA[
                    h = form.]]><gxsl:value-of select="@formcode"/><![CDATA[.value;
                    h = h.replace(/&/g,'&amp;');
                    h = h.replace(/</g,'&lt;');
                    t = t + " ]]><gxsl:value-of select="@nicknamelow"/><![CDATA[=\"" + h + "\"";
            ]]></gxsl:for-each><![CDATA[
                    t = t + ">";
            ]]><gxsl:for-each select="../../../CVIProperties/CVIProperty[PropGroup/@virtual='1' and @key='1' and @attr='0']"><![CDATA[
                    h = form.]]><gxsl:value-of select="@formcode"/><![CDATA[.value;
                    h = h.replace(/&/g,'&amp;');
                    h = h.replace(/</g,'&lt;');
                    t = t + "<]]><gxsl:value-of select="@nickname"/><![CDATA[>" + h + "</]]><gxsl:value-of select="@nickname"/><![CDATA[>";
            ]]></gxsl:for-each><![CDATA[
                    t = t + "</]]><gxsl:value-of select="@concept"/><![CDATA[>";
                  }
                }
                t = t + "</]]><gxsl:value-of select="@concept"/>s<![CDATA[>";
                forms.action.]]><gxsl:value-of select="@path"/>s<![CDATA[.value = t;

            ]]></gxsl:for-each><![CDATA[

                document.forms["action"].submit();
              }

              function selectAll() {
                for (i = 0; i < document.forms.length; i++) {
                  var form = document.forms[i];
                  if (form.name=='selection') form.selected.checked = document.forms["action"].all.checked;
                }

                compute();
              }
            ]]>
          //</xsl:comment>
        </script>

        <gxsl:choose>
          <gxsl:when test="@treelist='1' and name(..)='CView'">
            <gxsl:choose>
              <gxsl:when test="../CVIRBindings/CVIRBinding">
                <xsl:choose>
                  <xsl:when test="Classes/Class">
                    <xsl:apply-templates select="{ancestor::CView/@name}/{@conceptcoll}/{@concept}[@{../CVIRBindings/CVIRBinding/@p2low}=/DPOutput/DPNavig/{ancestor::CView/CVInclude/@conceptcoll}/{ancestor::CView/CVInclude/@concept}/@{../CVIRBindings/CVIRBinding/@p1low}]">
                      <xsl:with-param name="root" select="."/>
                    </xsl:apply-templates>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:apply-templates select="{ancestor::CView/@name}/{@conceptcoll}/{@concept}">
                      <xsl:with-param name="root" select="."/>
                    </xsl:apply-templates>
                  </xsl:otherwise>
                </xsl:choose>
              </gxsl:when>
              <gxsl:otherwise>
                <xsl:apply-templates select="{ancestor::CView/@name}/{@conceptcoll}/{@concept}">
                  <xsl:with-param name="root" select="."/>
                </xsl:apply-templates>
              </gxsl:otherwise>
            </gxsl:choose>
          </gxsl:when>
          <gxsl:otherwise>
          <!-- <xsl:apply-templates select="{@conceptcoll}/{@concept}"> -->
            <gxsl:choose>
              <gxsl:when test="../CVIRBindings/CVIRBinding">
                <xsl:choose>
                  <xsl:when test="Classes/Class">
                    <xsl:apply-templates select="{@conceptcoll}/{@concept}[@{../CVIRBindings/CVIRBinding/@p2low}=/DPOutput/DPNavig/{ancestor::CView/CVInclude/@conceptcoll}/{ancestor::CView/CVInclude/@concept}/@{../CVIRBindings/CVIRBinding/@p1low}]">
                      <xsl:with-param name="root" select="."/>
                    </xsl:apply-templates>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:apply-templates select="{@conceptcoll}/{@concept}">
                      <xsl:with-param name="root" select="."/>
                    </xsl:apply-templates>
                  </xsl:otherwise>
                </xsl:choose>
              </gxsl:when>
              <gxsl:otherwise>
                <xsl:apply-templates select="{@conceptcoll}/{@concept}">
                  <xsl:with-param name="root" select="."/>
                </xsl:apply-templates>
              </gxsl:otherwise>
            </gxsl:choose>
          </gxsl:otherwise>
        </gxsl:choose>

        <xsl:if test="@filterfirst=1">
          <tr>
            <td align="center" colspan="{{1+{count(CVIProperties/CVIProperty[@onlist='show'])}}}">
              <br/><b><gxsl:value-of select="$dict/Text[@tid='filter_first']/Value[@lang=$lang]"/></b><br/>
            </td>
          </tr>
        </xsl:if>

	<xsl:choose>
	  <xsl:when test="Classes/Class">
	    <xsl:for-each select="Classes/Class">
	      <tr><td class="text"><xsl:attribute name="colspan"><xsl:choose><xsl:when test="/DPOutput/DPList/@filterfirst='1'"><xsl:value-of select="1+11"/></xsl:when><xsl:otherwise><xsl:value-of select="1+11+$othercols"/></xsl:otherwise></xsl:choose></xsl:attribute></td></tr>
	      <tr><td class="text"><xsl:attribute name="colspan"><xsl:choose><xsl:when test="/DPOutput/DPList/@filterfirst='1'"><xsl:value-of select="1+11"/></xsl:when><xsl:otherwise><xsl:value-of select="1+11+$othercols"/></xsl:otherwise></xsl:choose></xsl:attribute></td></tr>
	      <tr><td class="text"><xsl:attribute name="colspan"><xsl:choose><xsl:when test="/DPOutput/DPList/@filterfirst='1'"><xsl:value-of select="1+11"/></xsl:when><xsl:otherwise><xsl:value-of select="1+11+$othercols"/></xsl:otherwise></xsl:choose></xsl:attribute></td></tr>
	      <tr><td class="text"><xsl:attribute name="colspan"><xsl:choose><xsl:when test="/DPOutput/DPList/@filterfirst='1'"><xsl:value-of select="1+11"/></xsl:when><xsl:otherwise><xsl:value-of select="1+11+$othercols"/></xsl:otherwise></xsl:choose></xsl:attribute></td></tr>
  	      <tr><td class="text"><xsl:attribute name="colspan"><xsl:choose><xsl:when test="/DPOutput/DPList/@filterfirst='1'"><xsl:value-of select="1+11"/></xsl:when><xsl:otherwise><xsl:value-of select="1+11+$othercols"/></xsl:otherwise></xsl:choose></xsl:attribute></td></tr>
	
	      <tr><td class="text">
	        <xsl:attribute name="colspan">
	          <xsl:choose>
	            <xsl:when test="/DPOutput/DPList/@filterfirst='1'">
	              <xsl:value-of select="1+11"/>
	            </xsl:when>
	            <xsl:otherwise>
	              <xsl:value-of select="1+11+$othercols"/>
	            </xsl:otherwise>
	          </xsl:choose>
	        </xsl:attribute>
	        <a class="text" href="../{{/DPOutput/@package}}/?dp=edit&amp;{ancestor::CView/CVInclude/Keys/Binding/@property}={{@value}}" target="_blank" style="cursor:pointer"><strong><xsl:value-of select="@caption"/></strong></a>
	      </td></tr>

        <gxsl:if test="../CVIRBindings/CVIRBinding/@p2low">
  	      <xsl:variable name="value"><xsl:value-of select="@value"/></xsl:variable>
          <xsl:apply-templates select="../../{@conceptcoll}/{@concept}[@{../CVIRBindings/CVIRBinding/@p2low}=$value]">
            <xsl:with-param select="/DPOutput/DPList" name="root"/>
          </xsl:apply-templates>
        </gxsl:if>
	    </xsl:for-each>
	    <tr>
              <td class="text">
                <xsl:attribute name="colspan">
                <xsl:choose>
                  <xsl:when test="/DPOutput/DPList/@filterfirst='1'">
                    <xsl:value-of select="1+{count(CVIProperties/CVIProperty[@onlist='show'])}"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="1+{count(CVIProperties/CVIProperty[@onlist='show'])}+$othercols"/>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:attribute>
              <!-- classed listings are not going to be paged yet -->
              <!-- <xsl:apply-templates select="DPPage"/> -->
              </td>
            </tr>
	  </xsl:when>
	  <xsl:otherwise>
	    <tr>
              <td class="text">
                <xsl:attribute name="colspan">
                <xsl:choose>
                  <xsl:when test="/DPOutput/DPList/@filterfirst='1'">
                    <xsl:value-of select="1+{count(CVIProperties/CVIProperty[@onlist='show'])}"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="1+{count(CVIProperties/CVIProperty[@onlist='show'])}+$othercols"/>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:attribute>
              <xsl:apply-templates select="DPPage"/>
              </td>
            </tr>
	  </xsl:otherwise>
        </xsl:choose>
        
        <tr>
          <td>
            <xsl:attribute name="colspan">
              <xsl:choose>
                <xsl:when test="/DPOutput/DPList/@filterfirst='1'">
                  <xsl:value-of select="1+{count(CVIProperties/CVIProperty[@onlist='show'])}"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="1+{count(CVIProperties/CVIProperty[@onlist='show'])}+$othercols"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:attribute>
            <table border="0" cellspacing="0" cellpadding="0" width="100%" class="text">
              <tr>
                <td align="left">
                  <gxsl:if test="@create='1'">
                    <xsl:if test="/DPOutput/@access!='r'">
                      <xsl:call-template name="createButton">
                        <xsl:with-param name="dpList" select="."/>
                        <xsl:with-param name="plusSign">0</xsl:with-param>
                      </xsl:call-template>
                    </xsl:if>
                  </gxsl:if>
                  &#160;
                </td>
                <td align="right">
                  &#160;
                  <nobr>
                    <gxsl:if test="count(CVIStyles/CVIStyle[Style/StyleType/@name='list'])&gt;1">
                      <gxsl:for-each select="CVIStyles/CVIStyle[Style/StyleType/@name='list']">
                        <xsl:choose>
                          <xsl:when>
                            <gxsl:attribute name="test">@style=<gxsl:value-of select="position()"/></gxsl:attribute>
                            <gxsl:value-of select="Style/StyleTitles/StyleTitle[@id_lang=$lang]/Title"/>
                            <gxsl:if test="position()!=last()">&#160;|&#160;</gxsl:if>
                          </xsl:when>
                          <xsl:otherwise>
                            <a>
                              <xsl:attribute name="href">
                              <gxsl:choose>
                                <gxsl:when test="name(..)!='CView'">
                                  <xsl:text>?dp=list</xsl:text><gxsl:value-of select="../../@id_cvinclude"/>
                                  <gxsl:for-each select="../../../../../Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<gxsl:variable name="prop"><gxsl:choose><gxsl:when test="@inattr='1'">@<gxsl:value-of select="@propertylow"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="@property"/></gxsl:otherwise></gxsl:choose></gxsl:variable><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/{$prop}"/></gxsl:for-each>
                                  <gxsl:for-each select="../../ancestor::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p2"/>=<xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                                  <gxsl:for-each select="../../ancestor::CVInclude/Keys/Binding">
                                    <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                                    <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                                      <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                                    </gxsl:if>
                                  </gxsl:for-each>&amp;style=<gxsl:value-of select="position()"/>
                                </gxsl:when>
                                <gxsl:otherwise>
                                  <xsl:text>?dp=list<gxsl:value-of select="../../@id_cvinclude"/>&amp;style=<gxsl:value-of select="position()"/></xsl:text>
                                </gxsl:otherwise>
                              </gxsl:choose>
                              </xsl:attribute>
                              <gxsl:value-of select="Style/StyleTitles/StyleTitle[@id_lang=$lang]/Title"/>
                            </a><gxsl:if test="position()!=last()">&#160;|&#160;</gxsl:if>
                          </xsl:otherwise>
                        </xsl:choose>
                      </gxsl:for-each>
                    </gxsl:if>
                  </nobr>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <xsl:choose><xsl:when test="/DPOutput/DPList/@norec='yes'"><a href="?norec=no">.</a></xsl:when><xsl:when test="/DPOutput/DPList/@norec='no'"><a href="?norec=yes">.</a></xsl:when></xsl:choose>
      </xsl:template>


      <xsl:template match="{@concept}">
        <xsl:param name="root"></xsl:param>

        <xsl:variable name="rowclass">
          <gxsl:choose>
            <gxsl:when test="@treelist='1' and name(..)='CView'">row1</gxsl:when>
            <gxsl:otherwise>
              <xsl:choose>
                <xsl:when test="position() mod 2 =1">row1</xsl:when>
                <xsl:otherwise>row2</xsl:otherwise>
              </xsl:choose>
            </gxsl:otherwise>
          </gxsl:choose>
        </xsl:variable>
      <form name="selection">
        <tr class="{{$rowclass}}">
        <td class="row">
          <gxsl:choose>
            <gxsl:when test="@update='1' or @detail='1'">
              <a title="{$dict/Text[@tid='edt']/Value[@lang=$lang]}/{$dict/Text[@tid='detail']/Value[@lang=$lang]}">
                <xsl:attribute name="href">?dp=edit<gxsl:value-of select="@id_cvinclude"/>
                  <gxsl:for-each select="Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each>
                  <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>=<xsl:value-of select="/DPOutput/DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                  <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                    <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                    <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                      <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="/DPOutput/DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                    </gxsl:if>
                  </gxsl:for-each>
                </xsl:attribute>
                <xsl:choose>
                  <xsl:when test="not($root/DPPage/@at)"><xsl:value-of select="position()"/>.</xsl:when>
                  <xsl:otherwise><xsl:value-of select="$root/DPPage/@at + position() - 1"/>.</xsl:otherwise>
                </xsl:choose>
              </a>
            </gxsl:when>
            <gxsl:otherwise>
              <xsl:choose>
                <xsl:when test="not($root/DPPage/@at)"><xsl:value-of select="position()"/>.</xsl:when>
                <xsl:otherwise><xsl:value-of select="$root/DPPage/@at + position() - 1"/>.</xsl:otherwise>
              </xsl:choose>            
            </gxsl:otherwise>
          </gxsl:choose>
          <xsl:text>&#160;</xsl:text>
          
          <gxsl:if test="@delete='1'">            
            <xsl:if>
              <gxsl:attribute name="test">
                <gxsl:text>/DPOutput/@access!='r' and /DPOutput/BS_Person/prefdel='1'</gxsl:text>
                <gxsl:if test="@required='-'">and /DPOutput/DPList/DPPage/@total!=1</gxsl:if>
              </gxsl:attribute>
              <a title="{$dict/Text[@tid='rmv']/Value[@lang=$lang]}">
                <xsl:attribute name="href">?dp=remove<gxsl:value-of select="@id_cvinclude"/>
                  <gxsl:for-each select="Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each>
                  <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>=<xsl:value-of select="/DPOutput/DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                  <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                    <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                    <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                      <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="/DPOutput/DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                    </gxsl:if>
                  </gxsl:for-each>
                </xsl:attribute>
                <b>x</b>
              </a>
            </xsl:if>
          </gxsl:if>
        </td>

        <gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']">
          <gxsl:variable name="valsrcprm">
            <gxsl:choose>
              <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
              <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
            </gxsl:choose>
          </gxsl:variable>

        <gxsl:choose>
          <gxsl:when test="CPStaticValues/CPStaticValue">
            <td class="row">
              <xsl:choose>
                <gxsl:for-each select="CPStaticValues/CPStaticValue">
                  <xsl:when test="{$valsrcprm}='{statval}'"><gxsl:value-of select="title"/></xsl:when>                    
                </gxsl:for-each>
                <xsl:otherwise><xsl:value-of select="{$valsrcprm}"/></xsl:otherwise>
              </xsl:choose>
            </td>
          </gxsl:when>
          <gxsl:when test="@type='url'">
            <td class="row">
              <xsl:value-of select="{$valsrcprm}" disable-output-escaping="yes"/>
            </td>
          </gxsl:when>
          <gxsl:when test="@type='file'">
            <td class="row">
              <a target="_empty">
                <xsl:attribute name="href">
                  <xsl:value-of select="concat(/DPOutput/@cpath,'/cnt/',/DPOutput/@model,'/')"/>
                  <gxsl:if test="@default and @default!=''">
                    <gxsl:value-of select="@default"/><xsl:text>/</xsl:text><!-- specific subdir -->
                  </gxsl:if>
                  <xsl:value-of select="{$valsrcprm}" disable-output-escaping="yes"/>
                </xsl:attribute>
                <xsl:value-of select="{$valsrcprm}" disable-output-escaping="yes"/>
              </a>
            </td>
          </gxsl:when>
          <gxsl:when test="@type='boolean'">
            <td class="row">
              <xsl:choose>
                <xsl:when test="{$valsrcprm}='1'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='Yes']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:when test="{$valsrcprm}='0'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='No']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>&#160;</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </td>
          </gxsl:when>
          <gxsl:when test="@type='boolean_txt'">
            <td class="row">
              <xsl:choose>
                <xsl:when test="{$valsrcprm}='true'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='Yes']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:when test="{$valsrcprm}='false'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='No']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>&#160;</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </td>
          </gxsl:when>
          <gxsl:when test="@type='timestamp'">
            <td class="row">
              <nobr><xsl:value-of select="{$valsrcprm}"/></nobr>
            </td>
          </gxsl:when>          
          <gxsl:when test="@fetchtype='external' and @ref and @ref!='' and @extwork and @extwork!=''">            
            <xsl:variable name="sub"><xsl:if test="substring-before(substring-after(/DPOutput/@package,'.'),'.')='ro'">ro.</xsl:if></xsl:variable>
            <gxsl:choose>
              <gxsl:when test="not(RefProp)">
                <td class="row">                  
                  <a class="text" href="../{{substring-before(/DPOutput/@package,'.')}}.{{$sub}}{@extwork}/?dp=edit&amp;{@refprop}={{{$valsrcprm}}}" target="_blank" style="cursor:pointer">
                    <xsl:value-of select="{$valsrcprm}"/>
                  </a>
                </td>
              </gxsl:when>
              <gxsl:otherwise>
                <gxsl:for-each select="RefProp">
                  <td class="row">
                    <a class="text" href="../{{substring-before(/DPOutput/@package,'.')}}.{{$sub}}{../@extwork}/?dp=edit&amp;{../@refprop}={{{$valsrcprm}}}" target="_blank" style="cursor:pointer">
                      <gxsl:variable name="valsrcrefprm">
                        <gxsl:choose>
                          <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                          <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
                        </gxsl:choose>
                      </gxsl:variable>
                      <xsl:value-of select="{$valsrcrefprm}"/>
                    </a>
                  </td>
                </gxsl:for-each>
              </gxsl:otherwise>
            </gxsl:choose>
          </gxsl:when>
          <gxsl:when test="not(RefProp)">
            <td class="row">
              <gxsl:choose>            
                <gxsl:when test="@name='uid' and ancestor::CView/@name='eventlog'">
                  <a href="../sm.persselect/?dp=edit&amp;ID_Person={{{$valsrcprm}}}" target="_blank"><xsl:value-of select="{$valsrcprm}"/></a>
                </gxsl:when>
                <gxsl:when test="@name='work' and ancestor::CView/@name='eventlog'">
                  <xsl:choose>
                    <xsl:when test="@type!='dlt'">
                      <a href="../{{substring-before(/DPOutput/@package,'.')}}.{{@work}}/?dp=editanonkey&amp;key={{@oid}}" target="_blank"><xsl:value-of select="{$valsrcprm}"/></a>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="{$valsrcprm}"/>
                    </xsl:otherwise>
                  </xsl:choose>                                                    
                </gxsl:when>       
                <gxsl:otherwise>
                  <xsl:value-of select="{$valsrcprm}"/>
                </gxsl:otherwise>
              </gxsl:choose>
            </td>
          </gxsl:when>
          <gxsl:otherwise>
            <gxsl:for-each select="RefProp">
              <td class="row">
              <gxsl:variable name="valsrcrefprm">
                <gxsl:choose>
                  <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                  <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
                </gxsl:choose>
              </gxsl:variable>
              <xsl:value-of select="{$valsrcrefprm}"/>
              </td>
            </gxsl:for-each>
          </gxsl:otherwise>
        </gxsl:choose>
        </gxsl:for-each>

        <gxsl:if test="@update='1' or @detail='1'">
          <td class="row">
          <a>
            <xsl:attribute name="href">?dp=edit<gxsl:value-of select="@id_cvinclude"/>
              <gxsl:for-each select="Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each>
              <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>=<xsl:value-of select="/DPOutput/DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
              <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                  <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="/DPOutput/DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                </gxsl:if>
              </gxsl:for-each>
            </xsl:attribute>
            <b>
              <gxsl:choose>
                <gxsl:when test="@update='1'">
                  <xsl:choose>
                    <xsl:when test="/DPOutput/@access!='r'">
                      <gxsl:value-of select="$dict/Text[@tid='edt']/Value[@lang=$lang]"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <gxsl:value-of select="$dict/Text[@tid='detail']/Value[@lang=$lang]"/>                    
                    </xsl:otherwise>
                  </xsl:choose>
                </gxsl:when>
                <gxsl:when test="@detail='1'">        
                  <gxsl:value-of select="$dict/Text[@tid='detail']/Value[@lang=$lang]"/>
                </gxsl:when>
              </gxsl:choose>              
            </b>
          </a>
          </td>        
        </gxsl:if>
                                     
        <gxsl:if test="@delete='1'">
          <xsl:if test="/DPOutput/@access!='r'">
            <gxsl:choose>
              <gxsl:when test="@required='-'">
                <xsl:if test="/DPOutput/DPList/DPPage/@total!=1">
                  <td class="row">
                  <a>
                    <xsl:attribute name="href">?dp=remove<gxsl:value-of select="@id_cvinclude"/>
                      <gxsl:for-each select="Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each>
                      <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>=<xsl:value-of select="/DPOutput/DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                      <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                        <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                        <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                          <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="/DPOutput/DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                    </xsl:attribute>
                    <b><gxsl:value-of select="$dict/Text[@tid='rmv']/Value[@lang=$lang]"/></b>
                    </a>
                  </td>
                </xsl:if>
              </gxsl:when>
              <gxsl:otherwise>
                <td class="row">
                <a>
                  <xsl:attribute name="href">?dp=remove<gxsl:value-of select="@id_cvinclude"/>
                    <gxsl:for-each select="Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each>
                    <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>=<xsl:value-of select="/DPOutput/DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                    <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                      <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                      <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                        <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="/DPOutput/DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                      </gxsl:if>
                    </gxsl:for-each>
                  </xsl:attribute>
                  <b><gxsl:value-of select="$dict/Text[@tid='rmv']/Value[@lang=$lang]"/></b>
                  </a>
                </td>
              </gxsl:otherwise>
            </gxsl:choose>
          </xsl:if>
        </gxsl:if>

        <xsl:if test="not($root/@selectfun='no')">
          <td class="row">
          <a>
            <xsl:attribute name="href">JavaScript:select(<gxsl:for-each select="Keys/Binding">'<xsl:value-of select="@{@propertylow}"/>',</gxsl:for-each><gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@basegroup='true' and @onlabel='1']">'<gxsl:choose><gxsl:when test="@attr='1'"><xsl:value-of select='translate(@{@lowname},"&apos;\","")'/></gxsl:when><gxsl:otherwise><xsl:value-of select='translate({@name},"&apos;\","")'/></gxsl:otherwise></gxsl:choose>',</gxsl:for-each>{<gxsl:for-each select="CVIProperties/CVIProperty[(PropGroup/@select='1' and @onlist='show') or @key='1']"><gxsl:value-of select="translate(@nickname,'.','_')"/>:'<gxsl:variable name="val"><gxsl:choose><gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise></gxsl:choose></gxsl:variable><xsl:value-of select='translate({$val},"&apos;\&#x0A;&#x0D;","")'/>'<gxsl:if test="position()!=last()">,</gxsl:if></gxsl:for-each>})</xsl:attribute>
            <b><gxsl:value-of select="$dict/Text[@tid='select']/Value[@lang=$lang]"/></b>
          </a>
          </td>
        </xsl:if>

        <gxsl:choose>
          <gxsl:when test="@delete='1' and @deletecoll='1'">
            <xsl:if test="/DPOutput/@access!='r'">
              <gxsl:choose>
                <gxsl:when test="@required='-'">
                  <xsl:if test="/DPOutput/DPList/DPPage/@total!=1 or ($root/@selectfun and $root/@selectfun!='' and $root/@selectfun!='no' and $root/@allowmulti='1')">
                    <td>
                      <center>
                        <input type="checkbox" name="selected" onclick="compute();" class="input_filter"/>
                      </center>
  
                      <gxsl:for-each select="Keys/Binding[1]">
                        <gxsl:variable name="valsrcprm">
                          <gxsl:choose>
                            <gxsl:when test="@inattr='1'">@<gxsl:value-of select="@propertylow"/></gxsl:when>
                            <gxsl:otherwise><gxsl:value-of select="property"/></gxsl:otherwise>
                          </gxsl:choose>
                        </gxsl:variable>
                        <input type="hidden" name="key" value="{{{$valsrcprm}}}"/>
                      </gxsl:for-each>
  
                      <gxsl:for-each select="CVIProperties/CVIProperty[@key='1']">
                        <gxsl:variable name="valsrcprm">
                          <gxsl:choose>
                            <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                            <gxsl:otherwise><gxsl:value-of select="nicknamey"/></gxsl:otherwise>
                          </gxsl:choose>
                        </gxsl:variable>
                        <input type="hidden" name="{@formcode}" value="{{{$valsrcprm}}}"/>
                      </gxsl:for-each>
                    </td>
                  </xsl:if>
                </gxsl:when>
                <gxsl:otherwise>
                  <td>
                    <center>
                      <input type="checkbox" name="selected" onclick="compute();" class="input_filter"/>
                    </center>
  
                    <gxsl:for-each select="Keys/Binding[1]">
                      <gxsl:variable name="valsrcprm">
                        <gxsl:choose>
                          <gxsl:when test="@inattr='1'">@<gxsl:value-of select="@propertylow"/></gxsl:when>
                          <gxsl:otherwise><gxsl:value-of select="property"/></gxsl:otherwise>
                        </gxsl:choose>
                      </gxsl:variable>
                      <input type="hidden" name="key" value="{{{$valsrcprm}}}"/>
                    </gxsl:for-each>
  
                    <gxsl:for-each select="CVIProperties/CVIProperty[@key='1']">
                      <gxsl:variable name="valsrcprm">
                        <gxsl:choose>
                          <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                          <gxsl:otherwise><gxsl:value-of select="nicknamey"/></gxsl:otherwise>
                        </gxsl:choose>
                      </gxsl:variable>
                      <input type="hidden" name="{@formcode}" value="{{{$valsrcprm}}}"/>
                    </gxsl:for-each>
                  </td>
                </gxsl:otherwise>
              </gxsl:choose>
             </xsl:if>
          </gxsl:when>
          <gxsl:otherwise>
            <xsl:if test="$root/@selectfun and $root/@selectfun!='' and $root/@selectfun!='no' and $root/@allowmulti='1'">
              <td>
                <center>
                  <input type="checkbox" name="selected" onclick="compute();" class="input_filter"/>
                </center>

                <gxsl:for-each select="Keys/Binding[1]">
                  <gxsl:variable name="valsrcprm">
                    <gxsl:choose>
                      <gxsl:when test="@inattr='1'">@<gxsl:value-of select="@propertylow"/></gxsl:when>
                      <gxsl:otherwise><gxsl:value-of select="property"/></gxsl:otherwise>
                    </gxsl:choose>
                  </gxsl:variable>
                  <input type="hidden" name="key" value="{{{$valsrcprm}}}"/>
                </gxsl:for-each>

                <gxsl:for-each select="CVIProperties/CVIProperty[@key='1']">
                  <gxsl:variable name="valsrcprm">
                    <gxsl:choose>
                      <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                      <gxsl:otherwise><gxsl:value-of select="nicknamey"/></gxsl:otherwise>
                    </gxsl:choose>
                  </gxsl:variable>
                  <input type="hidden" name="{@formcode}" value="{{{$valsrcprm}}}"/>
                </gxsl:for-each>
              </td>
            </xsl:if>
          </gxsl:otherwise>
        </gxsl:choose>

        </tr>
      </form>

      <gxsl:if test="@treelist='1' and name(..)='CView'">
        <gxsl:variable name="cols"><gxsl:value-of select="count(CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show' and not(RefProp)])+count(CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']/RefProp)"/></gxsl:variable>
        <gxsl:for-each select="CVIRels/CVIRel/CVInclude[@virtual='0' and @treelist='1']">
          <xsl:if test="count({@nickcoll}/{@nickname})>0">
          <tr class="row2">
          <td class="row">&#160;</td>
          <td class="row" colspan="{$cols}">

          <gxsl:choose>
            <gxsl:when test="not(@hasflap) or @hasflap!='0'">
              <a>
                <xsl:attribute name="href">?dp=list<gxsl:value-of select="@id_cvinclude"/><gxsl:for-each select="../../Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each>
                <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding">
                  <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                    <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="@{@p1low}"/>
                  </gxsl:if>
                </gxsl:for-each>
                <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                  <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                  <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                    <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="@{@propertylow}"/>
                  </gxsl:if>
                </gxsl:for-each>
                </xsl:attribute>
                <xsl:attribute name="title"><gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']"><gxsl:value-of select="Title"/><gxsl:if test="position()!=last()">, </gxsl:if></gxsl:for-each></xsl:attribute>
                <i>- <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></i>
              </a>
            </gxsl:when>
            <gxsl:otherwise>
              <i>- <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></i>
            </gxsl:otherwise>
          </gxsl:choose>
          <br/>

          <table>
            <xsl:for-each select="{@nickcoll}/{@nickname}">
              <gxsl:variable name="ocvip" select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show' and @name=current()/@deforderby]"/>
              <gxsl:if test="$ocvip">
                <gxsl:variable name="deforderby">
                  <gxsl:choose>
                    <gxsl:when test="starts-with(@deforderby,'-')"><gxsl:value-of select="substring-after(@deforderby,'-')"/></gxsl:when>
                    <gxsl:otherwise><gxsl:value-of select="@deforderby"/></gxsl:otherwise>
                  </gxsl:choose>
                </gxsl:variable>
                <gxsl:variable name="deforder">
                  <gxsl:choose>
                    <gxsl:when test="starts-with(@deforderby,'-')">desc</gxsl:when>
                    <gxsl:otherwise>asc</gxsl:otherwise>
                  </gxsl:choose>
                </gxsl:variable>
                <xsl:sort>
                  <gxsl:attribute name="select">
                    <gxsl:choose>
                      <gxsl:when test="$ocvip/@attr='1'">@<gxsl:value-of select="$deforderby"/></gxsl:when>
                      <gxsl:otherwise><gxsl:value-of select="$deforderby"/></gxsl:otherwise>
                    </gxsl:choose>
                  </gxsl:attribute>
                  <gxsl:attribute name="order"><gxsl:value-of select="$deforder"/>ending</gxsl:attribute>
                </xsl:sort>
              </gxsl:if>
            <tr>
              <td>&#160;&#160;&#160;</td>
              <gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']">
                <td class="row">
                <gxsl:choose>
                  <gxsl:when test="@attr='1'">
                    <xsl:value-of select="@{@nicknamelow}"/>
                  </gxsl:when>
                  <gxsl:otherwise>
                    <xsl:value-of select="{@nickname}"/>
                  </gxsl:otherwise>
                </gxsl:choose>
                </td>
              </gxsl:for-each>
            </tr>
            </xsl:for-each>
          </table>
          </td>
          </tr>
          </xsl:if>

        </gxsl:for-each>
      </gxsl:if>

      </xsl:template>



  <xsl:template match="DPPage">
    <xsl:if test="@prev or @next">
      <xsl:if test="@prev">
        <a>
          <xsl:attribute name="href">?dp=<xsl:value-of select="/DPOutput/@dataport"/>&amp;<xsl:value-of select="@doc"/><xsl:text>.start=1</xsl:text>
            <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
              <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
              </gxsl:if>
            </gxsl:for-each>
            <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
              <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
              <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
              </gxsl:if>
            </gxsl:for-each>
          </xsl:attribute>
          <gxsl:value-of select="$dict/Text[@tid='first']/Value[@lang=$lang]"/>
        </a>
      </xsl:if>
      <xsl:if test="not(@prev)">
        <b><gxsl:value-of select="$dict/Text[@tid='first']/Value[@lang=$lang]"/></b>
      </xsl:if>
      |
      <xsl:apply-templates select="Link"/>

      <xsl:if test="@next">
        <a>
          <xsl:attribute name="href">?dp=<xsl:value-of select="/DPOutput/@dataport"/>&amp;<xsl:value-of select="@doc"/>.start=<xsl:value-of select="@last"/>
            <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
              <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
              </gxsl:if>
            </gxsl:for-each>
            <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
              <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
              <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
              </gxsl:if>
            </gxsl:for-each>
          </xsl:attribute>
          <gxsl:value-of select="$dict/Text[@tid='last']/Value[@lang=$lang]"/>
        </a>
      </xsl:if>
      <xsl:if test="not(@next)">
        <b><gxsl:value-of select="$dict/Text[@tid='last']/Value[@lang=$lang]"/></b>
      </xsl:if>
      <div><gxsl:value-of select="$dict/Text[@tid='total']/Value[@lang=$lang]"/><xsl:text>&#160;</xsl:text><xsl:value-of select="@total"/><xsl:text>&#160;</xsl:text><gxsl:value-of select="$dict/Text[@tid='records']/Value[@lang=$lang]"/>.</div>

    </xsl:if>
  </xsl:template>


  <xsl:template match="Link">
    <xsl:if test="@here">
      <b><xsl:value-of select="@upto"/></b>
    </xsl:if>
    <xsl:if test="not(@here)">
      <a>
        <xsl:attribute name="href">?dp=<xsl:value-of select="/DPOutput/@dataport"/>&amp;<xsl:value-of select="../@doc"/>.start=<xsl:value-of select="@at"/>
          <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
            <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
              <xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
            </gxsl:if>
          </gxsl:for-each>
          <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
            <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
            <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
              <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../../../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
            </gxsl:if>
          </gxsl:for-each>
        </xsl:attribute>
        <xsl:choose>
          <xsl:when test="@big='yes'">
            <b><xsl:value-of select="@upto"/></b>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="@upto"/>
          </xsl:otherwise>
        </xsl:choose>
      </a>
    </xsl:if>
    |
  </xsl:template>



    <xsl:template match="DPFilter">
      <xsl:param name="propcols"/>
      <xsl:param name="othercols"/>

      <script language="JavaScript" type="text/javascript" src="{{/DPOutput/@cpath}}/sta/{{/DPOutput/@repository}}/fnc/mambo.js"/>
      <script language="JavaScript" type="text/javascript">
        <xsl:comment>
          <![CDATA[
            function checkfilter()
            {
              var form = document.forms.action; ]]>
              <gxsl:for-each select="CVIProperties/CVIProperty[@onfilter='show' or @onlist='show']">
                <gxsl:choose>
                  <gxsl:when test="RefProp">
                    <gxsl:for-each select="RefProp">

                      <gxsl:choose>
                        <gxsl:when test="@type='int'">
                          if (!valInt(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='float'">
                          if (!valFloat(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='date'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISO")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISO")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='datetime'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='timestamp'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        </gxsl:when>
                      </gxsl:choose>
                    </gxsl:for-each>
                  </gxsl:when>

                  <gxsl:otherwise>
                    <gxsl:choose>
                      <gxsl:when test="@type='int'">
                        if (!valInt(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                      </gxsl:when>
                      <gxsl:when test="@type='float'">
                        if (!valFloat(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                      </gxsl:when>
                      <gxsl:when test="@type='date'">
                        if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISO")) return false;
                        if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISO")) return false;
                      </gxsl:when>
                      <gxsl:when test="@type='datetime'">
                        if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                      </gxsl:when>
                      <gxsl:when test="@type='timestamp'">
                        if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                      </gxsl:when>
                    </gxsl:choose>
                  </gxsl:otherwise>
                </gxsl:choose>
              </gxsl:for-each>

          <![CDATA[
              return true;
            }

            function setAstra(elem)
            {
                    //var str=elem.value;
                    //str=delChar(str,"%&;=");
                    //if (str.charAt(str.length-1) != "*" && str.length > 0)
                    //{
                    //       str+="*";
                    //}
                    //elem.value=str;
            }

            function delChar(s,del)
            {
                    var delka=s.length;
                    var pom="";
                    var i=0;

                    while(i<delka)
                    {
                            if(del.indexOf(s.charAt(i)) == -1)
                            {
                                    pom += s.charAt(i);
                            }
                    i++;
                    }
                    return pom;
            }
          ]]>
        //</xsl:comment>
      </script>

      <tr>
        <td colspan="{{1+$propcols+$othercols}}">
          <table cellspacing="0" cellpadding="0" width="100%">
            <tr>
              <td width="50%" align="left">
                <nobr>
                <input type="hidden" name="setfilter" value="no"/>
                <input type="hidden" name="{@concept}.filterfirst" value="0"/>

                <input type="button" class="input_filter" onclick="setfilterfnc();">
                  <xsl:attribute name="value"><gxsl:value-of select="$dict/Text[@tid='set_filter']/Value[@lang=$lang]"/></xsl:attribute>&#160;
                </input>

                <script language="JavaScript" type="text/javascript">
                  <xsl:comment>
                    <![CDATA[
                      function setfilterfnc() {
                        if (checkfilter()) {
                          document.forms["action"].setfilter.value="yes";
                          document.forms["action"].dp.value="list]]><gxsl:value-of select="@id_cvinclude"/><![CDATA[";
                          document.forms["action"].submit();
                        }
                      }

                      function setpagestepfnc() {
                        document.forms["action"].setfilter.value="no";
                        document.forms["action"].dp.value="list]]><gxsl:value-of select="@id_cvinclude"/><![CDATA[";
                        document.forms["action"].submit();
                      }
                      
                      function checkfiltersubmit(event) {
                        if (event.keyCode==13 || event.which==13) setfilterfnc();
                      }
                      
                      function checkpagestepsubmit(event) {
                        if (event.keyCode==13 || event.which==13) setpagestepfnc();
                      }                      
                    ]]>
                  //</xsl:comment>
                </script>

                <font size="-1"><gxsl:value-of select="$dict/Text[@tid='pagestep']/Value[@lang=$lang]"/>:&#160;</font>
                <input type="text" name="{@concept}.step" size="5" class="input_filter" onkeypress="checkpagestepsubmit(event)">
                  <xsl:attribute name="value">
                    <xsl:choose>
                      <xsl:when test="../DPPage">
                        <xsl:value-of select="../DPPage/@step"/>
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="'-1'"/>
                      </xsl:otherwise>
                    </xsl:choose>
                  </xsl:attribute>
                </input>
                <input type="hidden" name="{@concept}.start" value="1"/>
                <input type="button" class="input_filter" onclick="setpagestepfnc();">
                  <gxsl:attribute name="value"><gxsl:value-of select="$dict/Text[@tid='change']/Value[@lang=$lang]"/></gxsl:attribute>
                </input>
                </nobr>
              </td>
              <td width="50%" align="right">
                <nobr>
                <xsl:if test="../@filterfirst!='1'">

                  <gxsl:if test="@canexport='0' and @canprint='0'">
                    <gxsl:choose>
                      <gxsl:when test="@update='0'">&#160;</gxsl:when>
                      <gxsl:otherwise><xsl:if test="/DPOutput/@access='r'">&#160;</xsl:if></gxsl:otherwise>
                    </gxsl:choose>
                  </gxsl:if>

                  <gxsl:if test="@canexport='1'">
                    &#160;&#160;&#160;
                    <font size="-1"><gxsl:value-of select="$dict/Text[@tid='export']/Value[@lang=$lang]"/>: <a target="new">
                    <xsl:attribute name="href">?dp=expxls<gxsl:value-of select="@id_cvinclude"/>
                      <gxsl:for-each select="../CVIRBindings/CVIRBinding"><xsl:text>&amp;<gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:for-each>
                      <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding">
                        <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                          <xsl:text>&amp;<gxsl:value-of select="@p1"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                      <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                        <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                        <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                          <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                        </gxsl:if>
                      </gxsl:for-each>
                    </xsl:attribute>Excel</a></font>
                  </gxsl:if>

                  <gxsl:for-each select="../CVIRBindings/CVIRBinding">
                    <input type="hidden" name="{@p1}" value="{{../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}}}"/>
                  </gxsl:for-each>

                  <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                    <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
                      <input type="hidden" name="{@p1}" value="{{../../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}}}"/>
                    </gxsl:if>
                  </gxsl:for-each>

                  <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                    <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                    <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                      <input type="hidden" name="{@property}" value="{{../../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}}}"/>
                    </gxsl:if>
                  </gxsl:for-each>

                  <gxsl:if test="@canprint='1'">
                    <script language="JavaScript" type="text/javascript">
                      <xsl:comment>
                        <![CDATA[
                          function openprintwindow()
                          {
                            var f=document.edit;
                            var path="?dp=print]]><gxsl:value-of select="@id_cvinclude"/><gxsl:for-each select="../CVIRBindings/CVIRBinding">&amp;<gxsl:value-of select="@p1"/>="+document.forms.action.<gxsl:value-of select="@p1"/>.value+"</gxsl:for-each><gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>="+document.forms.action.<gxsl:value-of select="@p1"/>.value+"</gxsl:if></gxsl:for-each><gxsl:for-each select="ancestor::CVInclude/Keys/Binding"><gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable><gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">&amp;<gxsl:value-of select="@property"/>="+document.forms.action.<gxsl:value-of select="@property"/>.value+"</gxsl:if></gxsl:for-each><gxsl:if test="@filterfirst='1'">&amp;<gxsl:value-of select="@concept"/>.filterfirst=0</gxsl:if><![CDATA[&style="+document.forms.action.printstyle.value+"&ssnctl=hdrext";
                            var sFeatures = "dependent=yes,toolbar=yes,scrollbars=yes,location=no,status=no,resizable=yes,height="+document.body.clientHeight+",width="+document.body.clientWidth+",top="+window.screenTop+",left="+window.screenLeft;
                            window.open(path,"external",sFeatures);
                          }
                        ]]>
                      //</xsl:comment>
                    </script>
                    &#160;&#160;&#160;
                    <font size="-1"><a href="javascript:openprintwindow();"><gxsl:value-of select="$dict/Text[@tid='openprint']/Value[@lang=$lang]"/>:</a>&#160;</font>
                    <select size="1" name="printstyle" class="input_filter">
                      <gxsl:choose>
                        <gxsl:when test="CVIStyles/CVIStyle[Style/StyleType/@name='print']">
                          <gxsl:for-each select="CVIStyles/CVIStyle[Style/StyleType/@name='print']">
                            <option>
                              <gxsl:attribute name="value"><gxsl:value-of select="position()"/></gxsl:attribute>
                              <gxsl:value-of select="Style/Name"/>
                            </option>
                          </gxsl:for-each>
                        </gxsl:when>
                        <gxsl:otherwise>
                          <option value="1">
                            Default
                          </option>
                        </gxsl:otherwise>
                      </gxsl:choose>
                    </select>
                  </gxsl:if>
                </xsl:if>
                </nobr>
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr cellspacing="0" cellpadding="0" style="margin : 0; padding : 0;">
        <th>
          <gxsl:if test="@create='1'">
            <xsl:if test="/DPOutput/@access!='r'">
              <xsl:call-template name="createButton">
                <xsl:with-param name="dpList" select=".."/>
                <xsl:with-param name="plusSign">1</xsl:with-param>
              </xsl:call-template>
            </xsl:if>
          </gxsl:if>
        </th>

        <gxsl:variable name="propprefix">
          <gxsl:choose>
            <gxsl:when test="@treelist='1' and name(..)='CView'">/<gxsl:value-of select="@concept"/>/</gxsl:when>
            <gxsl:otherwise></gxsl:otherwise>
          </gxsl:choose>
        </gxsl:variable>

        <gxsl:for-each select="CVIProperties/CVIProperty[@onlist='show']">
          
            <gxsl:choose>
              <gxsl:when test="CPStaticValues">
                <th>
                  <xsl:variable name="fval"><xsl:value-of select="child::node()[@property='{$propprefix}{@name}']/@default"/></xsl:variable>
                  <select size="1" name="{@formcode}" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)">
                    <option value="">--- <gxsl:value-of select="$dict/Text[@tid='all_short']/Value[@lang=$lang]"/> ---</option>
                    <gxsl:for-each select="CPStaticValues/CPStaticValue">
                      <option value='{statval}'>
                        <xsl:if test="$fval='{statval}'">
                          <xsl:attribute name="selected">yes</xsl:attribute>
                        </xsl:if>
                        <gxsl:value-of select="title"/>
                      </option>                    
                    </gxsl:for-each>
                  </select>
                </th>
              </gxsl:when>
              <gxsl:when test="not(RefProp)">
                <th>
                <gxsl:choose>
                  <gxsl:when test="@type='boolean'">
                    <select size="1" name="{@formcode}" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)">
                      <option value=""><gxsl:value-of select="$dict/Text[@tid='all_short']/Value[@lang=$lang]"/></option>
                      <option value="1">
                        <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='1'">
                          <xsl:attribute name="selected">yes</xsl:attribute>
                        </xsl:if>
                        <gxsl:value-of select="$dict/Text[@tid='Yes']/Value[@lang=$lang]"/>
                      </option>
                      <option value="0">
                        <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='0'">
                          <xsl:attribute name="selected">yes</xsl:attribute>
                        </xsl:if>
                        <gxsl:value-of select="$dict/Text[@tid='No']/Value[@lang=$lang]"/>
                      </option>
                    </select>
                  </gxsl:when>
                  <gxsl:when test="@type='boolean_txt'">
                    <select size="1" name="{@formcode}" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)">
                      <option value=""><gxsl:value-of select="$dict/Text[@tid='all_short']/Value[@lang=$lang]"/></option>
                      <option value="true">
                        <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='true'">
                          <xsl:attribute name="selected">yes</xsl:attribute>
                        </xsl:if>
                        <gxsl:value-of select="$dict/Text[@tid='Yes']/Value[@lang=$lang]"/>
                      </option>
                      <option value="false">
                        <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='false'">
                          <xsl:attribute name="selected">yes</xsl:attribute>
                        </xsl:if>
                        <gxsl:value-of select="$dict/Text[@tid='No']/Value[@lang=$lang]"/>
                      </option>
                    </select>
                  </gxsl:when>
                  <gxsl:when test="@type='date' or @type='datetime' or @type='timestamp'">
                    <xsl:variable name="fnode" select="child::node()[@nick='{$propprefix}{@name}_from']"/>
                    <xsl:variable name="fval">
                      <xsl:choose>
                        <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                        <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <nobr><input type="text" name="{@formcode}_from" value="{{$fval}}" size="8" class="input_filter" onfocus="setCurrentDate(this)" style="width:50%" onkeypress="checkfiltersubmit(event)"/><input type="text" name="{@formcode}_to" value="{{child::node()[@nick='{$propprefix}{@name}_to']/@default}}" size="8" class="input_filter" onfocus="setCurrentDate(this)" style="width:50%" onkeypress="checkfiltersubmit(event)"/></nobr>
                  </gxsl:when>
                  <gxsl:when test="@type='int' or @type='float'">
                    <xsl:variable name="fnode" select="child::node()[@property='{$propprefix}{@name}']"/>
                    <xsl:variable name="fval">
                      <xsl:choose>
                        <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                        <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <input type="text" name="{@formcode}" value="{{$fval}}" size="8" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)"/>
                  </gxsl:when>
                  <gxsl:otherwise>
                    <gxsl:variable name="len">
                      <gxsl:choose>
                        <gxsl:when test="number(@len)&gt;15">15</gxsl:when>
                        <gxsl:when test="number(@len)&gt;5 and number(@len)&lt;=15"><gxsl:value-of select="@len"/></gxsl:when>
                        <gxsl:otherwise>5</gxsl:otherwise>
                      </gxsl:choose>
                    </gxsl:variable>
                    <xsl:variable name="fnode" select="child::node()[@property='{$propprefix}{@name}']"/>
                    <xsl:variable name="fval">
                      <xsl:choose>
                        <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                        <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <input type="text" name="{@formcode}" value="{{$fval}}" size="{$len}" class="input_filter" onChange="setAstra(this)" style="width:100%" onkeypress="checkfiltersubmit(event)"/>
                  </gxsl:otherwise>
                </gxsl:choose>
                </th>
              </gxsl:when>

              <gxsl:when test="@ref and @ref!='' and @fetchtype='direct'">
                <gxsl:choose>
                  <gxsl:when test="RefProp">
                    <gxsl:for-each select="RefProp">
                      <th>
                        <select size="1" name="{../@formcode}{@formcode}" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)">
                        <option value=""><gxsl:value-of select="$dict/Text[@tid='all_short']/Value[@lang=$lang]"/></option>
                        <xsl:for-each>
                          <gxsl:attribute name="select">
                            <gxsl:text>../Opts/</gxsl:text><gxsl:value-of select="../@refconceptcoll"/>/<gxsl:value-of select="../@refconcept"/>
                            <gxsl:text>[</gxsl:text>
                            <gxsl:choose>
                              <gxsl:when test="@attr='1'">
                                <gxsl:text/>@<gxsl:value-of select="@lowcode"/> and @<gxsl:value-of select="@lowcode"/>!=''<gxsl:text/>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <gxsl:value-of select="@code"/> and <gxsl:value-of select="@code"/>!=''<gxsl:text/>
                              </gxsl:otherwise>
                            </gxsl:choose>
                            <gxsl:text>]</gxsl:text>
                          </gxsl:attribute>
                          <option>
                            <gxsl:choose>
                              <gxsl:when test="@attr='1'">
                                <xsl:attribute name="value"><xsl:value-of select="@{@simplenamelow}"/></xsl:attribute>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <xsl:attribute name="value"><xsl:value-of select="{@simplename}"/></xsl:attribute>
                              </gxsl:otherwise>
                            </gxsl:choose>
                            <gxsl:choose>
                              <gxsl:when test="@attr='1'">
                                <xsl:if test="@{@simplenamelow}=../../../DPFilter/child::node()[@property='{../@nickname}.{@refconcept}/{@simplename}']/@default">
                                  <xsl:attribute name="selected">yes</xsl:attribute>
                                </xsl:if>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <xsl:if test="{@simplename}=../../../DPFilter/child::node()[@property='{../@nickname}.{@refconcept}/{@simplename}']/@default">
                                  <xsl:attribute name="selected">yes</xsl:attribute>
                                </xsl:if>
                              </gxsl:otherwise>
                            </gxsl:choose>
      
                            <gxsl:choose>
                              <gxsl:when test="@attr='1'">
                                <xsl:value-of select="@{@lowcode}"/>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <xsl:value-of select="{@code}"/>
                              </gxsl:otherwise>
                            </gxsl:choose>
                          </option>
                        </xsl:for-each>
                      </select>
                      </th>
                    </gxsl:for-each>
                  </gxsl:when>
                  <gxsl:otherwise>
                    <th>
                      <select size="1" name="{@formcode}" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)">
                      <option value=""><gxsl:value-of select="$dict/Text[@tid='all_short']/Value[@lang=$lang]"/></option>
                      <xsl:for-each select="../Opts/{@refconceptcoll}/{@refconcept}">
                        <option>
                          <gxsl:choose>
                            <gxsl:when test="@attr='1'">
                              <xsl:attribute name="value"><xsl:value-of select="@{@refproplow}"/></xsl:attribute>
                            </gxsl:when>
                            <gxsl:otherwise>
                              <xsl:attribute name="value"><xsl:value-of select="{@refprop}"/></xsl:attribute>
                            </gxsl:otherwise>
                          </gxsl:choose>
                          <gxsl:choose>
                            <gxsl:when test="@attr='1'">
                              <xsl:if test="@{@refproplow}=../../../DPFilter/child::node()[@property='{$propprefix}{@name}']/@default">
                                <xsl:attribute name="selected">yes</xsl:attribute>
                              </xsl:if>
                            </gxsl:when>
                            <gxsl:otherwise>
                              <xsl:if test="{@refprop}=../../../DPFilter/child::node()[@property='{$propprefix}{@name}']/@default">
                                <xsl:attribute name="selected">yes</xsl:attribute>
                              </xsl:if>
                            </gxsl:otherwise>
                          </gxsl:choose>

                          <xsl:value-of select="@{@refproplow}"/>
                        </option>
                      </xsl:for-each>
                    </select>
                    </th>                  
                  </gxsl:otherwise>
                </gxsl:choose>
              </gxsl:when>

              <gxsl:otherwise>                
                <gxsl:for-each select="RefProp">
                  <th>
                  <gxsl:variable name="rptitle">
                    <gxsl:choose>
                      <gxsl:when test="last()>1"><gxsl:value-of select="../Title"/>: <gxsl:value-of select="Title"/></gxsl:when>
                      <gxsl:otherwise><gxsl:value-of select="../Title"/></gxsl:otherwise>
                    </gxsl:choose>
                  </gxsl:variable>

                  <gxsl:choose>
                    <gxsl:when test="@type='date' or @type='datetime' or @type='timestamp'">
                      <xsl:variable name="fnode" select="child::node()[@nick='{../@nickname}.{@refconcept}/{@code}_from']"/>
                      <xsl:variable name="fval">
                        <xsl:choose>
                          <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                          <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                        </xsl:choose>
                      </xsl:variable>
                      <nobr><input type="text" name="{../@formcode}{@formcode}_from" value="{{$fval}}" size="8" class="input_filter" onfocus="setCurrentDate(this)" style="width:50%" onkeypress="checkfiltersubmit(event)"/><input type="text" name="{../@formcode}{@formcode}_to" value="{{child::node()[@nick='{../@nickname}.{@refconcept}/{@code}_to']/@default}}" size="8" class="input_filter" onfocus="setCurrentDate(this)" style="width:50%" onkeypress="checkfiltersubmit(event)"/></nobr>
                    </gxsl:when>
                    <gxsl:when test="@type='int' or @type='float'">
                      <xsl:variable name="fnode" select="child::node()[@property='{../@nickname}.{@refconcept}/{@code}']"/>
                      <xsl:variable name="fval">
                        <xsl:choose>
                          <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                          <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                        </xsl:choose>
                      </xsl:variable>
                      <input type="text" name="{../@formcode}{@formcode}" value="{{$fval}}" size="8" class="input_filter" style="width:100%" onkeypress="checkfiltersubmit(event)"/>
                    </gxsl:when>
                    <gxsl:otherwise>
                      <gxsl:variable name="len">
                        <gxsl:choose>
                          <gxsl:when test="number(@len)&gt;15">15</gxsl:when>
                          <gxsl:when test="number(@len)&gt;5 and number(@len)&lt;=15"><gxsl:value-of select="@len"/></gxsl:when>
                          <gxsl:otherwise>5</gxsl:otherwise>
                        </gxsl:choose>
                      </gxsl:variable>
                      <xsl:variable name="fnode" select="child::node()[@property='{../@nickname}.{@refconcept}/{@code}']"/>
                      <xsl:variable name="fval">
                        <xsl:choose>
                          <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                          <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                        </xsl:choose>
                      </xsl:variable>
                      <input type="text" name="{../@formcode}{@formcode}" value="{{$fval}}" size="{$len}" class="input_filter" onChange="setAstra(this)" style="width:100%" onkeypress="checkfiltersubmit(event)"/>
                    </gxsl:otherwise>
                  </gxsl:choose>
                  </th>
                </gxsl:for-each>
              </gxsl:otherwise>
            </gxsl:choose>
        </gxsl:for-each>

        <xsl:if test="/DPOutput/DPList/@filterfirst!='1'">
          <xsl:call-template name="putTH">
            <xsl:with-param name="howmany" select="$othercols"/>
          </xsl:call-template>
        </xsl:if>

      </tr>
    </xsl:template>

    <xsl:template name="putTH">
      <xsl:param name="howmany"/>
      <xsl:choose>
        <xsl:when test="number($howmany)>0">
          <th> </th>
          <xsl:call-template name="putTH">
            <xsl:with-param name="howmany" select="number($howmany)-1"/>
          </xsl:call-template>
        </xsl:when>
      </xsl:choose>
    </xsl:template>

    <xsl:template name="title"><gxsl:value-of select="ancestor::CView/CVTitles/CVTitle/Title"/></xsl:template>

  <xsl:template name="createButton">
    <xsl:param name="dpList"/>
    <xsl:param name="plusSign">0</xsl:param>

    <xsl:if test="$dpList/DPPage/@total!='{@required}' or (not($dpList/DPPage) and count({@conceptcoll}/{@concept})!='{@required}')">
      <a>
        <xsl:attribute name="href">?dp=create<gxsl:value-of select="@id_cvinclude"/>
          <gxsl:for-each select="../CVIRBindings/CVIRBinding">&amp;<gxsl:value-of select="@p2"/>=<xsl:value-of select="$dpList/../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:for-each>
          <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p2"/>=<xsl:value-of select="$dpList/../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
          <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
            <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
            <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
              <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="$dpList/../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
            </gxsl:if>
          </gxsl:for-each>                                        
        </xsl:attribute>
  
        <gxsl:variable name="btntitle">
          <gxsl:choose>
            <gxsl:when test="CVITitles/CVITitle and CVITitles/CVITitle[@id_cttype='createbutton']/Title">
              <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='createbutton']/Title"/>
            </gxsl:when>
            <gxsl:otherwise>
              <gxsl:value-of select="$dict/Text[@tid='crt']/Value[@lang=$lang]"/>
            </gxsl:otherwise>
          </gxsl:choose>
        </gxsl:variable>
        
        <xsl:choose>
          <xsl:when test="$plusSign='1'">      
            <xsl:attribute name="title">
              <gxsl:value-of select="$btntitle"/>
            </xsl:attribute>
            <xsl:text>+</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <gxsl:value-of select="$btntitle"/>
          </xsl:otherwise>
        </xsl:choose>
      </a>
    </xsl:if>
  </xsl:template>

  </gxsl:template>

</gxsl:stylesheet>
